# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=i3wm
pkgver=4.18.2
pkgrel=0
pkgdesc="Improved dynamic tiling window manager"
url="https://i3wm.org"
arch="all"
license="BSD-3-Clause"
makedepends="
	bison
	cairo-dev
	flex
	libev-dev
	libxcb-dev
	libxkbcommon-dev
	pango-dev
	pcre-dev
	perl
	startup-notification-dev
	xcb-util-cursor-dev
	xcb-util-keysyms-dev
	xcb-util-wm-dev
	xcb-util-xrm-dev
	yajl-dev
	"
subpackages="
	$pkgname-dev
	$pkgname-doc
	$pkgname-save_tree:savetree:noarch
	"
source="
	https://i3wm.org/downloads/i3-$pkgver.tar.bz2
	"
builddir="$srcdir/i3-$pkgver"
options="!check" # missing perl bindings for libxcb

build() {
	./configure \
		--prefix=/usr \
		--disable-builddir \
		--sysconfdir=/etc
	make
}

package() {
	make DESTDIR="$pkgdir/" install

	install -d "$pkgdir/usr/share/man/man1"
	install -m644 man/*.1 "$pkgdir"/usr/share/man/man1/
}

savetree() {
	pkgdesc="Session export tool for $pkgname"
	depends="$pkgname=$pkgver-r$pkgrel perl-anyevent-i3"
	mkdir -p "$subpkgdir"/usr/bin
	mv "$pkgdir"/usr/bin/i3-save-tree "$subpkgdir"/usr/bin/
}

sha512sums="997c7cdf32f95ba25cfcd483a09f7e37e5219e4501baefa5c1865ddffd206bc9725211e4082663fab4174dc947b663ff454d343a7e30340ac3ea451f999417fc  i3-4.18.2.tar.bz2"
